﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Fuzzy
{
    public partial class main : Form
    {
        public main()
        {
            InitializeComponent();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
            
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            newfile1.Show();
            newfile1.setMainForm(this);
            this.BringToFront();
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.ShowDialog();
             
        }
        //FUNCTION WILL BE CALLED WHEN USER CLICKS OK BUTTON ON OPENFILE DIALOG
        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            xmlFile.Path = openFileDialog1.FileName;
            saveToolStripMenuItem.Enabled = true;
            queryToolStripMenuItem.Enabled = true;
            addDataToolStripMenuItem.Enabled = true;
            sortToolStripMenuItem.Enabled = true;
            deleteDataToolStripMenuItem.Enabled = true;
            displayToolStripMenuItem.Enabled = true;
          
        }
        //FUNCTION TO SET XMLFILE CLASS PATH
        public void setNewPath(string s)
        {
            xmlFile.Path = s;
            xmlFile.createFile();
                saveToolStripMenuItem.Enabled = true;
                queryToolStripMenuItem.Enabled = true;
                addDataToolStripMenuItem.Enabled = true;
                sortToolStripMenuItem.Enabled = true;
                deleteDataToolStripMenuItem.Enabled = true;
                displayToolStripMenuItem.Enabled = true;
            
        }

        private void displayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            display1.setMainForm(this);
            this.Hide();
            display1.showdata();
            display1.Show();
            

        }

        private void addDataToolStripMenuItem_Click(object sender, EventArgs e)
        {
            addrecord1.setMainForm(this);
            this.Hide();
            addrecord1.Show();
        }

        private void deleteDataToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            deleteform1.setMainForm(this);
            deleteform1.Show();
        }

       
        

        
        
        


     
       
    }
}
